import { userState, userInfo } from './types'
import { shopDataSourceFace } from "@/pages/shop/list/type"
const state: userState = {
    userInfo: {
        nickName: "",
        account: "",
        phone: "",
        sex: "",
        uuid: "",
        address: '',
        shops: []
    },
    token: "",
    shop: "",
    shopsOptions: [],
}
export default {
    state,
    actions: {
        setToken(newState: userState, actions: { type: string, value: string }) {
            newState.token = actions.value
        },
        setUserInfo(newState: userState, actions: { type: string, value: userInfo }) {
            newState.userInfo = actions.value
        },
        setShopData(newState: userState, actions: { type: string, value: string }) {
            newState.shop = actions.value
        },
        setShopsOptions(newState: userState, actions: { type: string, value: shopDataSourceFace[] }) {
            newState.shopsOptions = actions.value
        }
    },
    actionsName: {
        setToken: "setToken",
        setUserInfo: "setUserInfo",
        setShopData: "setShopData",
        setShopsOptions: "setShopsOptions"
    }
}